
    loginForm.addEventListener("submit",function(event){
      event.preventDefault();
      if(loginForm.checkValidity()){
        fetch("/api/rest/user/login",{
          method: "POST",
          body: new FormData(loginForm),
        })
        .then((response)=>{
          if(response.ok){
            window.location.href = "index.html";
          }
        })
        .catch((error) =>{
          console.error("Error:",error);
        });
      }else{
        loginForm.classList.add("was-validated");
      }
    });
